package com.nlelpct.manage.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.nlelpct.manage.mapper.SysEmployeeAndDeptMapper;
import com.nlelpct.manage.model.entity.SysEmployeeAndDept;
import com.nlelpct.manage.service.SysEmployeeDepartmentService;
import org.springframework.stereotype.Service;

import java.util.ArrayList;
import java.util.List;

import cn.hutool.core.util.ArrayUtil;

@Service
public class SysEmployeeDepartmentServiceImpl extends ServiceImpl<SysEmployeeAndDeptMapper,SysEmployeeAndDept> implements SysEmployeeDepartmentService {

    @Override
    public List<SysEmployeeAndDept> getSysEmployeeAndDeptByDeptIds(List<String> deptIds) {
        List<SysEmployeeAndDept> sysEmployeeAndDepts = new ArrayList<>();
        if (ArrayUtil.isNotEmpty(deptIds)) {
            LambdaQueryWrapper<SysEmployeeAndDept> lambdaQueryWrapper = new LambdaQueryWrapper<>();
            lambdaQueryWrapper.in(SysEmployeeAndDept::getDeptId, deptIds);
            sysEmployeeAndDepts = this.list(lambdaQueryWrapper);
        }
        return sysEmployeeAndDepts;
    }
}
